<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        p{
            display: none;
        }

        .active{
            color: red;
        }
        .show{
            display: block;
        }
    </style>
</head>
<body>

    <div>
        <button class="active">1</button>
        <button>2</button>
        <button>3</button>
    </div>
    <div>
        <p>1</p>
        <p>2</p>
        <p>3</p>
    </div>

    <script src="../js/jq_v2.js"></script>
    <script>
        $('button').click(function() {
            // this 指向  button这个按钮
            // $(this).css('color' , 'red').siblings().css('color' , 'black') ;
            // $('p').hide().eq($(this).index()).show()
            $(this).addClass('active').siblings().removeClass('active') ;
            $('p').removeClass('show').eq($(this).index()).addClass('show')
        })

    </script>
    
</body>
</html>